<template>
    <!-- 遮罩层 -->
    <div v-if="visible" class="overlay" @click="closeModal"></div>

    <!-- 弹窗 -->
    <div v-if="visible" class="modal">
        <div class="modal-title">
            <img src="../assets/me_home/dingweimao.png" alt="">
            <div class="title-text">{{ bianObj.title }} 变电站</div>
            <span class="close-btn" @click="closeModal">&times;</span> 
        </div>
        <div class="modal-con">
            <div class="con-item" @click="openBianZhan(bianObj)" style="cursor: pointer;">
                <img src="../assets/me_home/guizi.png" alt="" style="width: 54px;height: 45px;">
                <div class="name">变电柜数量</div>
                <div class="number">{{ bianObj.bian_number }}</div>
            </div>
            <div class="con-item">
                <img src="../assets/me_home/jinbao.png" alt="" style="width: 35px;height: 35px;">
                <div class="name">警报</div>
                <div class="number">{{ bianObj.bian_jinBao }}</div>
            </div>
            <div class="con-item">
                <img src="../assets/me_home/zhongbiao.png" alt=""  style="width: 35px;height: 35px;">
                <div class="name">安装时间</div>
                <div class="timetext">{{ bianObj.time }}</div>
            </div>
            
        </div>

    </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue';

// 定义 props
const props = defineProps({
    visible: {
        type: Boolean,
        default: false,
    },
    // title: {
    //     type: String,
    //     default: '弹窗标题',
    // },
    bianObj: {
        type: Object,
        default: {}
    }
});

// 跳转ue模型关卡
const openBianZhan = (obj)=>{
    ue5("openBianZhan", obj.title)
    console.log("=====>",obj)
}

// 定义 emits
const emit = defineEmits(['update:visible']);

// 关闭弹窗
const closeModal = () => {
    emit('update:visible', false);
};
</script>

<style scoped lang="scss">
/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    // padding: 20px;
    background: #000000;
    // border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.modal-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #323332;
    padding: 10px 20px;
    box-sizing: border-box;

    img {
        width: 35px;
        height: 35px;
    }

    .title-text {
        margin-left: 10px;
        font-size: 16px;
        width: 300px;
    }
}

.modal-con {
    background-color: #202121;
    width: 100%;
    height: 180px;
    display: flex;
    justify-content: space-between;

    .con-item {
        padding-top: 30px;
        width: 150px;
        height: 150px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-around;
        .name{
            color: #8e8f8f;
            font-size: 14px;
            margin-top: 10px;
        }
        .number{
            width: 100%;
            height: 60px;
            text-align: center;
            font-size: 24px;
            font-weight: bold;
        }
        .timetext{
            width: 100%;
            height: 60px;
            text-align: center;
            font-size: 18px;
            font-weight: bold;

        }
        // img {
        //     width: 54px;
        //     height: 45px;
        // }
    }
    .con-item + .con-item{
        border-left: 1px solid #373535;
    }
}

/* 关闭按钮 */
.close-btn {
    float: left;
    cursor: pointer;
    font-size: 26px;
    font-weight: bold;
    // width: 220px;
    text-align: right;
}
</style>